<?php
include("./API.php");
include("../config.php");
tongji("changya");
$hh=$_GET["hh"]?:"\n";//换行符号(默认\n)
function GetBetween($content,$start,$end){
$r = explode($start, $content);
if (isset($r[1])){
$r = explode($end, $r[1]);
return $r[0];
}
return '';
}
$json = file_get_contents("https://m.api.singduck.cn/user-piece/6oGNUeM16kBuRmPct?userId=2003919010");
$json = json_decode(GetBetween($json,'<script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">','</script>'),true);
$ugcId=$json["props"]["pageProps"]["pieces"][rand(0,5)]["ugcId"];
$type=$_GET["type"];
if ($ugcId==null) {
echo "".$web["ming"]."API随机唱鸭".$hh."";
echo "━━━━━━━━━".$hh."";
echo "服务器错误".$hh."";
echo "━━━━━━━━━".$hh."";
echo "Tips:".$web["ming"]."API技术支持";
}else if($type == "json") {
$Json=json_decode(GetBetween(file_get_contents("https://m.api.singduck.cn/user-piece/".$ugcId."?userId=2003919010"),'<script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">','</script>'),true);
$bflj=$Json["props"]["pageProps"]["clip"]["audioSrc"];//播放链接
$name=$Json["props"]["pageProps"]["singerUserInfo"]["nickname"];//作者昵称
$tx=$Json["props"]["pageProps"]["singerUserInfo"]["avatar_url"];//作者头像
echo 'json:{"app":"com.tencent.structmsg","desc":"音乐","view":"music","ver":"0.0.0.1","prompt":"[分享]随机唱鸭","appID":"","sourceName":"","actionData":"","actionData_A":"","sourceUrl":"","meta":{"music":{"action":"","android_pkg_name":"","app_type":1,"appid":100497308,"desc":"'.$name.'","jumpUrl":"https://music.163.com/","musicUrl":"'.$bflj.'","preview":"'.$tx.'","sourceMsgId":"0","source_icon":"","source_url":"","tag":"酷我音乐","title":"唱鸭"}},"config":{"autosize":true,"ctime":1575625127,"forward":true,"token":"7fef9b7d1e63b3500a42462126e9bc3d","type":"normal"},"text":"","sourceAd":""}';
}else if($type == "xml") {
$Json=json_decode(GetBetween(file_get_contents("https://m.api.singduck.cn/user-piece/".$ugcId."?userId=2003919010"),'<script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">','</script>'),true);
$bflj=$Json["props"]["pageProps"]["clip"]["audioSrc"];//播放链接
$name=$Json["props"]["pageProps"]["singerUserInfo"]["nickname"];//作者昵称
$tx=$Json["props"]["pageProps"]["singerUserInfo"]["avatar_url"];//作者头像
echo 'card:1<?xml version=\'1.0\' encoding=\'UTF-8\' standalone=\'yes\' ?><msg serviceID="2" templateID="1" action="web" brief="[分享]随机唱鸭" sourceMsgId="0" url="" flag="0" adverSign="0" multiMsgFlag="0"><item layout="2"><audio cover="'.$tx.'" src="'.$bflj.'" /><title>点击播放</title><summary>'.$name.'</summary></item><source name="" icon="" action="app" a_actionData="com.tencent.qqmusic" i_actionData="tencent1101079856://" appid="1101079856" /></msg>';
}else{
$Json=json_decode(GetBetween(file_get_contents("https://m.api.singduck.cn/user-piece/".$ugcId."?userId=2003919010"),'<script id="__NEXT_DATA__" type="application/json" crossorigin="anonymous">','</script>'),true);
$audioSrc=$Json["props"]["pageProps"]["clip"]["audioSrc"];//播放链接
$nickname=$Json["props"]["pageProps"]["singerUserInfo"]["nickname"];//作者昵称
$avatar_url=$Json["props"]["pageProps"]["singerUserInfo"]["avatar_url"];//作者头像
$lyrics="";//歌词
foreach($Json["props"]["pageProps"]["clip"]["lyrics"] as $vv)
{
$lyrics.=$vv."".$hh."";
}
echo "".$web["ming"]."API随机唱鸭".$hh."";
echo "━━━━━━━━━".$hh."";
echo "±img=".$avatar_url."±".$hh."";
echo "作者昵称:".$nickname."".$hh."";
echo "歌词:".$lyrics."";
echo "播放链接:".$audioSrc."".$hh."";
echo "━━━━━━━━━".$hh."";
echo "Tips:".$web["ming"]."API技术支持";
}
?>